package com.android.readcard.utils;

import android.os.Environment;
import android.text.format.DateFormat;
import android.util.Log;

import java.io.File;
import java.util.Calendar;
import java.util.Locale;

/**
 * 第三方拍照配置
 * 2018/1/15
 * 张鹏
 */

public class GlobalPathUtils {
    public static final String STR_PATH = "/feihongtemp/";

    /**
     * 获取根目录
     *
     * @return
     */
    public static File getFileDirectory() {
        String sdDir = null;
        boolean sdCardExist = Environment.getExternalStorageState()
                .equals(android.os.Environment.MEDIA_MOUNTED);//判断sd卡是否存在
        Log.e("GlobalPathUtils", "------getFileDirectory------" + sdCardExist);
        sdDir = Environment.getExternalStorageDirectory().toString();//获取跟目录
        Log.e("GlobalPathUtils", "------sdCardExist------" + sdDir);
        return Environment.getExternalStorageDirectory();
    }

    /**
     * 获取时间格式化路径名称
     *
     * @return
     */
    public static String getDateFormatPhotoPath() {
        return STR_PATH + DateFormat.format("yyyyMMdd_hhmmss", Calendar.getInstance(Locale.CHINA)) + ".jpg";
    }

}
